#
#  Copyright 2022 The Open Islands Authors. All Rights Reserved.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#


class MQArgs(object):
    def __init__(
            self,
            mq_type,
            host: str = None,
            port: int = None,
            servers: str = None,
            user: str = None,
            password: str = None,
            params: dict = None
    ):
        self.mq_type = mq_type
        self.host = host
        self.port = port
        self.servers = servers
        self.user = user
        self.password = password
        self.params = params
        self._num_partitions = params["num_partitions"]
        self._max_message_size = params["max_message_size"]

    @property
    def max_message_size(self):
        return self._max_message_size

    def __str__(self):
        return f"type: {self.mq_type}, host: {self.host}, port: {self.port}, user: {self.user}, max message size: {self.max_message_size}"

    def __repr__(self):
        return self.__str__()
